<?php
/**
 * Created by PhpStorm.
 * User: Dominik
 * Date: 4/7/14
 * Time: 9:46 PM
 * IDENTIFICATION
 */

include("validator.php");
$validator = new Validator();

if(isset($_POST[next])){

    if($validator->validAlfaAndSpace($_POST[name])){
        $report[name] = "Jmeno muze obsahovat pouze znaky a mezery.";
    }
    if($validator->validAlfaAndSpace($_POST[familyname])){
        $report[familyname] = "Prijmeni muze obsahovat pouze znaky a mezery.";
    }

    if(empty($report)){
        session_start();
        $_SESSION = Array();
        $_SESSION['name']=$_POST[name];
        $_SESSION['familyname']=$_POST[familyname];
        ?>
        <meta http-equiv="refresh" content="0;url=http://databaze.fbmi.cvut.cz/fialadom/BITWA/CV7/wizzard2.php">
        <?
    }
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta name="zajimaveeeeeee" content="PhpStorm 7.0">
    <link rel="stylesheet" type="text/css" href="style.css">
    <title>BITWA - Fiala Dominik</title>

</head>
<body>
<div id="hlavicka">
    <h1 align="center">BITWA</h1><br>
</div>
<div id="menu">
    <? include "menu.php" ?>
</div>
<div id="obsah">
    <form method="POST" action="" autocomplete="on" >

        <label for="name"> Jmeno </label>
        <input type="text" id="name" name="name" placeholder="name" value="<?php echo $_POST['name'];?>">

        <br/>
        <label for="username"> Prijmeni </label>
        <input type="text" id="familyname" name="familyname" placeholder="familyname" value="<?php echo $_POST['familyname'];?>">

        <br/>
        <input type="submit" name="next" value="Dalsi">
    </form>

    <?php
    foreach($report as $ch){
        echo "<b>".$ch."</b><br>";
    }
    ?>

</div>
<div id="copyright">
    &copy fialadom
</div>
</body>
</html>